<?php


namespace App\Transformers\User;


use App\Models\SystemUserLevel;
use App\Models\User;
use App\Models\UserLevel;
use League\Fractal\TransformerAbstract;

class UserLevelTransformer extends TransformerAbstract
{
    public function transform(UserLevel $userLevel)
    {
        return [
            'id' => $userLevel->id,
            'user_id' => $userLevel->user_id ?? '',
            'merchant_id' => $userLevel->merchant_id ?? '',
            'level_id' => $userLevel->level_id ?? '',
            'grade' => $userLevel->grade ?? '',
            'valid_time' => $userLevel->valid_time ?? '',
            'mark' => $userLevel->mark ?? '',
            'discount' => $userLevel->discount ?? '',
            'deleted_at' => $userLevel->deleted_at ? $userLevel->deleted_at->format("Y-m-d H:i:s") : '',
            'created_at' => $userLevel->created_at ? $userLevel->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $userLevel->updated_at ? $userLevel->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
